import React from "react";
import { RootStateContext } from "./context";

export function useState() {
  const state = React.useContext(RootStateContext);

  if (state === null) {
    throw new Error(
      "'RootStateContext' cannot be null, please add 'RootProvider' to the root component."
    );
  }
  return state;
}
